<template>
	<div style="width:100%">
		<div id="maind" style="min-width: 100%;height:280px;"></div>
	
	</div>
</template>

<script>
	import * as echarts from 'echarts';
	export default {
		name:"tubiaoa",
		props: ['jieyueliangmsg'],
		  data(){
			  return{
			  	tongjimsg:{},
				datelist:[],
				jielist:[],
				huanlist:[],
			  }
		  },
		  watch:{
			  jieyueliangmsg(oldval,newval){
				  this.getmsg()
			  }
		  },
		  created () {
			
		  },
		  mounted(){
			this.getmsg()
		  },
		  methods:{
			  async getmsg(){
				  this.tongjimsg=this.jieyueliangmsg
				  this.datelist=[]
				  this.jielist=[]
				  this.huanlist=[]
				  for(let item of this.tongjimsg){
					  this.datelist.push(item.name)
					   this.jielist.push(item.jie_num) // 敏感
					   this.huanlist.push(item.huan_num) // 非敏感
				  }
				  console.log( '你好',this.datelist)
				  // this.jiemsg=this.jieyuemsg
				  let that =this
					  setTimeout(res=>{
						  that.getbiao()
					  },500)
					 
				  
				  
			  },
			  getbiao(){
				let a = this.datelist
				let b = this.jielist
				let c = this.huanlist
				
				// let b=this.jiemsg.borrow_zhanbi
				
				  // console.log('这是a',b)
				var myChart = echarts.init(document.getElementById('maind'));
				var option = {
					  title: {
					    text: ''
					  },
					  tooltip: {
					    trigger: 'axis'
					  },
					  legend: {
					    data: ['敏感', '非敏感', ]
					  },
					  grid: {
					    left: '3%',
					    right: '4%',
					    bottom: '3%',
					    containLabel: true
					  },
					  toolbox: {
					    feature: {
					      saveAsImage: {}
					    }
					  },
					  xAxis: {
					    type: 'category',
					    boundaryGap: false,
					    data:a
					  },
					  yAxis: {
					    type: 'value'
					  },
					  series: [
					    {
					      name: '敏感',
					      type: 'line',
					      stack: 'Total',
					      data: b
					    },
					    {
					      name: '非敏感',
					      type: 'line',
					      stack: 'Total',
					      data: c
					    },
					   
					  ]
					};
				
				  		
				        // 使用刚指定的配置项和数据显示图表。
				        myChart.setOption(option);
			  }
		  },
		
	}
</script>

<style>
</style>